home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
indeo
/
nwxmas.exe
/
XD_GRAPH.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-04
|
3KB
|
139 lines
/*
** ╔══════════════════════════════════════════════════════════════╗
** ║ ║
** ║ Copyright (c) 1993 Digital Video Arts, Ltd. ║
** ║ All Rights Reserved ║
** ║ ║
** ╚══════════════════════════════════════════════════════════════╝
**
** Christmas card demo
**
** file: xd_graph.c - hook after decompression
*/
#include <stdio.h>
#include <fcntl.h>
#include "nw.h"
#include "nwerrno.h"
#include "xmasdemo.h"
#define LOGODELAY 5*30
static long fc = 0L; // running frame total
void AvGraphics(AvS *s, Bitmap *b, Bitmap *b2, long frameno)
{
Point p1, p2;
static Rect lr1, lr2;
static int initialized = 0;
Rect r1, r2;
ColorVal c;
int i;
POINT(p1, 0, 0);
b->GrPlanes = P_Y; /* graphics only on Y plane only*/
balls->dbm.GrPlanes = P_Y;
onscreen->dbm.GrPlanes = P_C;
//
// Now, warp each of the three balls
//
for(i=0; i< MAXWARPS; i++)
GrCopyMap(&balls->dbm, &warps[i].origin, b, &p1, &map->dbm,
&warps[i], 1);
//
// Now, go through the list of balls and copy the warped image
// with transparency (blend later..)
//
YVU(c, 0, 0, 0);
for(i=0; i < MAXBALLS; i++)
GrCopyTrans(&onscreen->dbm,&Balls[i].p, &balls->dbm,
&warps[Balls[i].warpno],c);
RECT(r1, 0, 0, 256, 240);
RECT(r2, 128+24,18, 128-24,220-38);
text->dbm.GrPlanes = P_YVU;
GrScaleFast(&text->dbm, &r2, b, &r1);
//
// Logo.
//
CLT(c,0xfe);
onscreen->dbm.GrPlanes = P_C;
text->dbm.GrPlanes = P_C;
if(fc > LOGODELAY && fc < LOGODELAY + 220) {
POINT(p1, 140,0);
lr1.origin.x=0; lr1.origin.y = 219 - (fc-LOGODELAY);
lr1.corner.x = 128; lr1.corner.y = 220-lr1.origin.y;
GrCopyTrans(&text->dbm,&p1, &text->dbm,&lr1,c);
}
if(fc >= LOGODELAY+220) {
POINT(p1, 140, 0);
RECT(lr1, 0,0,128,220);
GrCopyTrans(&text->dbm,&p1, &text->dbm,&lr1,c);
}
POINT(p2, 256-64, 240-100);
onscreen->dbm.GrPlanes = P_YVU;
GrCopyTrans(&onscreen->dbm,&p2, &text->dbm,&r2,c);
if(!fc++)
VidShow(onscreen);
}
#ifdef __NWDLL
#include "nwglobs.hh"
#include "nwwindef.hh"
#endif
struct rect21 {
short argc;
VAddr src1;
int src1p;
int src1bpp;
VAddr src2;
int src2p;
int src2bpp;
VAddr dest;
int destp;
int destbpp;
int xsize;
int ysize;
};
static struct {
struct rect21 r21;
int transparency;
} copymap;
static McH *vcopymap=0;
Rect21(struct rect21 *, int, Bitmap *, Point *, Bitmap *, Point *,
Bitmap *, Rect *);
GrCopyMap(Bitmap *destb, Point *destp, Bitmap *src1b, Point *src1p,
Bitmap *src2b, Rect *src2r, int trans)
{
int i, plane;
if(!vcopymap) vcopymap = McFunc("vcopymap");
if(!vcopymap) return -1;
if(!destb) return 0;
if((src1b->Type != destb->Type) ||
(src1b->Type != src2b->Type)) {
SET_NWERRNO(E_GRINCOMPTYPES);
return -1;
}
copymap.r21.argc = sizeof(copymap)/2 - 1;
copymap.transparency = trans;
for(i = 0, plane = 1; i< destb->SubPlane; i++, plane <<= 1) {
if(!Rect21(©map.r21, plane, destb, destp,
src1b, src1p, src2b, src2r)) continue;
McRun(vcopymap, (short *)©map);
}
return 1;
}